package com.jpro.module.infra.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;

public class SiteUtil {
    public static final String SITE_PARAM = "jprocms-site-id";

    public static Long getSiteId(HttpServletRequest request) {
        String p = request.getHeader(SITE_PARAM);
        if (StringUtils.isBlank(p)) {
            p = request.getParameter(SITE_PARAM);
        }
        if (StringUtils.isNumeric(p)) {
            return Long.valueOf(p);
        }
        return null;
    }
}
